<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<div>
		<p>你好：<span id="name"></span></p>
	</div>
	<script>
		var obj = {};
		Object.defineProperty(obj, 'name', {
			get() {
				console.log('get')
				return document.querySelector('#name').innerHTML;
			},
			set(name) {
				console.log('set')
				document.querySelector('#name').innerHTML = name
			}
		})
		
		obj.name = '波仔'
	</script>
</body>
</html>